import React, { Component } from "react";
import axios from "axios";
export default class One extends Component {
    state = {
        list: [
            { pre: "2499", name: "手机", pop: "成人", id: "01" },
            { pre: "1499", name: "手机", pop: "儿童", id: "02" },
            { pre: "3499", name: "手机", pop: "儿童", id: "03" },
            { pre: "4499", name: "手机", pop: "成人", id: "04" },
            { pre: "5499", name: "手机", pop: "儿童", id: "05" },
        ],
        num: "17",
        age: 1
    }
    hotPop = () => {

    }
    getList = () => {
        return this.state.list.map(item => (
            <li key={item.id}>
                <span>名字：{item.name}</span>
                <span>价格：{item.name}</span>
                <span>适合人群：{item.name}</span>
            </li>
        ))
    }
    render() {
        let { hotPop, getList } = this
        let { age } = this.state
        return (
            <div>
                <h1>数据渲染案例</h1>
                <button onClick={hotPop}>人气爆款</button>
                <ul>
                    {getList()}
                </ul>
                <h1>{age}</h1>
            </div>
        )
    }
}



